package com.yanqu.road.server.cmd.activity.dafuweng;

import com.yanqu.road.pb.monopoly.MonopolyProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.DaFuWengActivity;
import com.yanqu.road.server.manager.cross.battle.DaFuWengMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CROSS_DA_FU_WENG_BATTLE_BOSS, desc = "跨服大富翁攻击怪物")
public class CrossBattleBossCmd extends CrossUnionCommand {

    private long serverId;
    private long userId;
    private int bossId;
    private int damage;
    private int activityId;
    private int buffTimes;
    private MonopolyProto.MonopolyPlayerMsg monopolyPlayerMsg;
    private String cost;
    private int type;
    private long yongBingCardNum;
    private int yongBingCardLimit;      //4.8快速击杀优化佣兵卡限制
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MonopolyProto.CrossBattleBossReqMsg reqMsg = MonopolyProto.CrossBattleBossReqMsg.parseFrom(packet.getBytes());
        bossId = reqMsg.getBossId();
        userId = reqMsg.getUserId();
        serverId = reqMsg.getServerId();
        damage = reqMsg.getDamage();
        activityId = reqMsg.getActivityId();
        monopolyPlayerMsg = reqMsg.getMonopolyPlayer();
        buffTimes = reqMsg.getBuffTimes();
        cost = reqMsg.getCost();
        type = reqMsg.getType();
        yongBingCardNum = reqMsg.getYongBingCardNum();
        yongBingCardLimit = reqMsg.getFastKillYongBingCardLimit();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        DaFuWengActivity daFuWengActivity = DaFuWengMgr.getDaFuWengActivity(activityId, groupId);
        if (daFuWengActivity == null) {
            return;
        }
        daFuWengActivity.attackBoss(serverId, userId, bossId, damage, monopolyPlayerMsg, type, buffTimes, cost, yongBingCardNum, yongBingCardLimit);
    }

    @Override
    public void sendData() {

    }
}
